from peewee import Model, MySQLDatabase, CharField, TextField

db = MySQLDatabase('books_recommend',
                   host="43.136.169.74",
                   port=3306,  # 端口 默认3306
                   user="books",
                   password="fy7777777")


class DataModel(Model):
    class Meta:
        database = db


class booksInfo(DataModel):  # 招聘岗位
    book_name = CharField(max_length="255", verbose_name="书名")
    book_author = CharField(max_length="255", verbose_name="作者")
    book_abstract = TextField(default="", verbose_name="摘要")
    book_type = CharField(max_length="255", verbose_name="分类")
    book_label = CharField(max_length="255", verbose_name="标签")
    book_image = CharField(default="", max_length="255", verbose_name="封面图")
    book_link = CharField(max_length="255", verbose_name="链接")
    book_score = CharField(max_length="255", verbose_name="评分")


# 创建数据库
db.create_tables([booksInfo])
